// GetPropertyFunctionTrigger.h: interface for the GetPropertyFunctionTrigger class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_GETPROPERTYFUNCTIONTRIGGER_H__2A09C9CF_353E_404D_9BC2_2305C109784E__INCLUDED_)
#define AFX_GETPROPERTYFUNCTIONTRIGGER_H__2A09C9CF_353E_404D_9BC2_2305C109784E__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

namespace pa
{
	class PropertyOwner;
	class GetPropertyFunction;
	class DllExport GetPropertyFunctionTrigger  
	{
	public:
		GetPropertyFunctionTrigger();
		virtual ~GetPropertyFunctionTrigger();

	public:
		void GetTriggerFuns();
		void RunFuns();
		void Add(GetPropertyFunction* pFun);
		

	public:

		void Trigger()
		{
			if(m_bState)
			{
				GetTriggerFuns();
				RunFuns();
			}
		}

		void Open()
		{
			m_bState = true;
		}

		void Close()
		{
			m_bState = false;
		}

		PropertyOwner* GetOwner() const
		{
			return m_pOwner;
		}

		void SetOwner(PropertyOwner* pOwner)
		{
			m_pOwner = pOwner;
		}
		
		bool IsOpen() const
		{
			return m_bState;
		}	

	private:
		PropertyOwner* m_pOwner;
		bool m_bState;

	private:

		CList<GetPropertyFunction*, GetPropertyFunction*> m_theTriggerFuns;

	};
};

#endif // !defined(AFX_GETPROPERTYFUNCTIONTRIGGER_H__2A09C9CF_353E_404D_9BC2_2305C109784E__INCLUDED_)
